Imports Microsoft.VisualBasic
Imports LookUp
Imports System.Data

Public Class WebFormCommon
    Inherits System.Web.UI.UserControl

    Private mParent As Page
    Private mControlMode As ControlMode

    Enum ControlMode
        NewBusiness = 1
        ClientServicing = 2
    End Enum

    Public Property PageControlMode() As ControlMode
        Get
            PageControlMode = mControlMode
        End Get
        Set(ByVal value As ControlMode)
            mControlMode = value
        End Set
    End Property

    Public Property ParentPage() As System.Web.UI.Page
        Get
            ParentPage = mParent
        End Get
        Set(ByVal value As System.Web.UI.Page)
            mParent = value
        End Set
    End Property

    Public Sub InitVars()
        If Not IsNothing(Session("Seq_CD")) Then ViewState.Add("Seq_CD", Session("Seq_CD"))
        If Not IsNothing(Session("CID")) Then ViewState.Add("CID", Session("CID"))
        If Not IsNothing(Session("viewtag")) Then ViewState.Add("viewtag", Session("viewtag"))
        If Not IsNothing(Session("mode")) Then ViewState.Add("mode", Session("mode"))
        If Not IsNothing(Session("advisor")) Then ViewState.Add("advisor", Session("advisor"))
        If Not IsNothing(Session("SDate")) Then ViewState.Add("SDate", Session("SDate"))

        If Not IsNothing(Session("PolicyNo")) Then
            ViewState.Add("PolicyNo", Session("PolicyNo"))
        End If
        If Not IsNothing(Session("Provider")) Then
            ViewState.Add("Provider", Session("Provider"))
        End If
        If Not IsNothing(Session("CName")) Then
            ViewState.Add("CName", Session("CName"))
        End If

        ViewState.Add("UserName", Session("UserName"))
        Session.Clear()
        Session.Add("UserName", ViewState("UserName"))
        Session.Add("advisor", ViewState("advisor"))
    End Sub

    Public Sub InitSessions()
        If Not IsNothing(ViewState("Seq_CD")) Then Session.Add("Seq_CD", ViewState("Seq_CD"))
        If Not IsNothing(ViewState("PolicyNo")) Then Session.Add("PolicyNo", ViewState("PolicyNo"))
        If Not IsNothing(ViewState("Provider")) Then Session.Add("Provider", ViewState("Provider"))
        If Not IsNothing(ViewState("CID")) Then Session.Add("CID", ViewState("CID"))
        If Not IsNothing(ViewState("CName")) Then Session.Add("CName", ViewState("CName"))
        If Not IsNothing(ViewState("viewtag")) Then Session.Add("viewtag", ViewState("viewtag"))
        If Not IsNothing(ViewState("mode")) Then Session.Add("mode", ViewState("mode"))

        ViewState.Clear()
    End Sub
End Class

